<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="node_modules/vue/dist/vue.min.js"></script>
    <style>
        .pink{
            background-color: pink;
        }
        .yellow{
            background-color: yellow;
        }
    </style>
</head>
<body>
    <div id='con'>

        <ul>
            <li v-for="(v,i) in arr" :class="v.style?'pink':'yellow'" @click="fun(i)">
                {{v.name}}--------{{v.num}}
            </li>
        </ul>
        xxxxx

    </div>
    <script>
        new Vue({
            el:"#con",
            data:{
                arr:[
                    {name:"香蕉",num:2.5,style:true},
                    {name:"橘子",num:3.5,style:true},
                    {name:"hehe",num:19.5,style:true},
                    {name:"haha",num:30,style:true}
                    
                ]
            },
            methods:{
                fun(i){
                    console.log(i)
                    this.arr[i].style=!this.arr[i].style
                }
            }
        })
    </script>
</body>
</html>